<%-- 
    Document   : orderDetails
    Created on : 2015-6-27, 19:25:15
    Author     : MY
--%>

<%@page import="bookstore.model.Book"%>
<%@page import="bookstore.model.Good"%>
<%@page import="java.util.List"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>购物车</title>
        <link rel="stylesheet" href="/iBook/css/all.css" type="text/css"/>
        <link rel="stylesheet" href="/iBook/css/bootstrap.min.css" type="text/css"/>
        <style>
            #picture {
                float:left;
            }
            #picture-text{
                padding-left: 15px;
                float:left;
            }
        </style>
    </head>
    <body>
        <jsp:include  page="/common/top.jsp"/>
        <div class="container">
            <table class="table table-hover table-striped">
                <tr ><th style="width: 800px">商品信息</th><th>单价（元）</th><th>数量</th><th>金额</th><th>操作</th></tr>
                        <%
                            List<Good> goodList = (List<Good>) session.getAttribute("goodList");
                            Good good = null;
                            float total = 0;
                            if(goodList != null)
                                    {
                            for (int i = 0; i < goodList.size(); ++i) {
                                good = goodList.get(i);
                                total += good.getTotal();
                        %>
                <tr>
                    <td><div>                
                            <div id="picture">
                                <img src="/iBook/bookimages/<%=good.getBook().getPicture()%>"  height="80" width="60" class="img-thumbnail">
                            </div>   
                            <a href="#"><div id="picture-text"><strong><%=good.getBook().getName()%></strong></div></a>
                        </div>
                    </td>
                    <td><%=good.getBook().getPrice()%></td>
                    <td><%=good.getCount()%></td>
                    <td id="total"><%=good.getTotal()%></td>
                    <td><a href="/iBook/DeleteFromCar.action?book_id=<%=good.getBook().getId() %>">删除</a></td>
                </tr>
                <%}}%>
            </table>
       <%
                            if(goodList != null)
                            {
       %>
            <nav class="navbar navbar-default navbar-fixed-bottom">
                <div class="container">
                    <div class="container-fluid">
                    <div class="row" >
                        <div class="col-md-10">
                            <h2 style="float: right">合计：<span style="color: #cc0000"><%=total%></span>(元)</h2>
                       
                        </div>
                            <div class=" col-md-2" style=" margin-top: 10px">
                                <a href="/iBook/book/orderInfo.jsp?total=<%=total%>" class="btn btn-danger btn-primary btn-lg" onclick=>去结算</a>
                        </div>
                    </div>
                </div>
                </div>
            </nav>
                        <%}%>
        </div>            
    </body>
</html>
